//
// Created by LinorInk on 2024/3/17.
//

#ifndef DRATSERVO_SERVO_H
#define DRATSERVO_SERVO_H
#include "stm32f4xx_hal.h"
#include "servo_inf.h"



extern TIM_HandleTypeDef htim1;
extern TIM_HandleTypeDef htim2;
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim4;
extern TIM_HandleTypeDef htim5;
extern TIM_HandleTypeDef htim8;
extern TIM_HandleTypeDef htim9;
extern TIM_HandleTypeDef htim11;

#define SERVO_TIM_HANDLE &htim2
#define SERVO_NUM 19

typedef struct {
    TIM_HandleTypeDef *htim;
    uint8_t TIM_Channel;
    uint8_t id;
    uint8_t angle;
}Servo_HandleTypedef;

typedef struct {
    TIM_HandleTypeDef *htim;
    uint8_t TIM_Channel;
}Servo_InitTypedef;

void servo_init();

#endif //DRATSERVO_SERVO_H
